local dianguo = fk.CreateSkill({
  name = "lingling__dianguo",
  tags = { Skill.Limited },
})

Fk:loadTranslationTable{
  ["lingling__dianguo"] = "颠锅",
  [":lingling__dianguo"] = "限定技，出牌阶段，你可以令一名其他角色身份牌和武将牌翻面，手牌数和体力值翻倍。",

  ["#lingling__dianguo"] = "颠锅：令一名角色身份牌和武将牌翻面，手牌数和体力值翻倍",

  ["$lingling__dianguo1"] = "修厥身，允德协天下。",
  ["$lingling__dianguo2"] = "天难堪，命靡常；常厥德，保厥位。",
}

dianguo:addEffect("active", {
  anim_type = "support",
  prompt = "#lingling__dianguo",
  card_num = 0,
  target_num = 1,
  can_use = function(self, player)
    return player:usedSkillTimes(dianguo.name, Player.HistoryGame) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected, selected_cards)
    return #selected == 0 and to_select ~= player
  end,
  on_use = function(self, room, effect)
    local target = effect.tos[1]
    if target.role_shown then
      room:broadcastProperty(target, "role")
      room:setPlayerProperty(target, "role_shown", false)
    else
      room:setPlayerProperty(target, "role_shown", true)
      room:broadcastProperty(target, "role")
    end
    target:turnOver()
    if target.dead then return end
    if not target:isKongcheng() then
      target:drawCards(target:getHandcardNum(), dianguo.name)
      if target.dead then return end
    end
    if target.hp > 0 then
      room:recover{
        who = target,
        num = target.hp,
        recoverBy = effect.from,
        skillName = dianguo.name,
      }
    end
  end,
})

return dianguo
